package com.bdweb.mokuai;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class txt2String {
    public  String txt2String(File file) throws IOException {

        StringBuilder result = new StringBuilder();
        try{
            BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
            String s = null;
            while((s = br.readLine())!=null){
                //使用readLine方法，一次读一行
                String str3 = s.replaceAll("","");
                result.append(str3);
            }
            br.close();
        }catch(Exception e){
            e.printStackTrace();
        }
        return result.toString();
    }
    public String getKey(File file) throws IOException {
        StringBuilder result = new StringBuilder();
        BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
        String s = null;
        while((s = br.readLine())!=null){
            //使用readLine方法，一次读一行
            String str3 = s.replaceAll("","");
            result.append(str3);

        }
        br.close();
        //System.out.println(result.toString()+1111);
        return result.toString();
    }
    public String get_Time(File file) throws IOException {
        StringBuilder result = new StringBuilder();
        BufferedReader br = new BufferedReader(new FileReader(file));//构造一个BufferedReader类来读取文件
        String s = null;
        while((s = br.readLine())!=null){
            //使用readLine方法，一次读一行
            String str3 = s.replaceAll("","");
            result.append(str3);

        }
        br.close();
        //System.out.println(result.toString()+1111);
        return result.toString();
    }
}
